package com.company.practice;

import java.lang.ref.WeakReference;
import java.util.concurrent.locks.LockSupport;

public class Test3 {


    public static void main(String[] args) throws InterruptedException {

        Object obj = new Object();
        WeakReference<Object> weakReference = new WeakReference<>(obj);

        System.out.println(weakReference);
        obj=null;
        Thread.sleep(5000);
        System.out.println(weakReference);
        LockSupport.park();

    }
}
